home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 8: LINUX Games / Linux Cubed Series 8 - LINUX Games.iso / games / muds / pennmush.000 / pennmush-1.50-p8-linux.tar / pennmush / dump.c < prev    next >
C/C++ Source or Header  |  1992-12-14  |  7KB  |  271 lines

  1. /* dump.c */
  2.  
  3. #include "copyright.h"
  4.  
  5. #include <stdio.h>
  6. #include "config.h"
  7. #include "db.h"
  8.  
  9. /* The following are needed so that modules that contain required code can
  10.  * be linked in.. However the following routines do not NEED to do anything.
  11.  */
  12. /*****************************************************************************/
  13.  
  14. int paranoid_checkpt = 1;
  15.  
  16. FILE *checklog_fp = stderr;
  17.  
  18. ATTR *aname_hash_lookup(string)
  19.      char *string;
  20. { return NULL; }
  21.  
  22. unsigned hash_fn()
  23. { return 0; }
  24.  
  25. void report()
  26. { }
  27.  
  28. dbref free_get()
  29. { return NOTHING; }
  30.  
  31. void fix_free_list()
  32. { }
  33.  
  34. void parse_que(player, command, cause)
  35.     dbref player, cause;
  36.     char *command;
  37. { }
  38.  
  39. int eval_boolexp(player, b, privs, nrecurs, locktype)
  40.      dbref player;
  41.      struct boolexp *b;
  42.      dbref privs;
  43.      int nrecurs;
  44.      int locktype;
  45. { return 1; }
  46.  
  47. int wild_match(s, d)
  48.     char *s, *d;
  49. { return 1; }
  50.  
  51. #define notify(p,m)     notify_check(p,m,0)
  52.  
  53. void notify_check(player, msg, no_puppet)
  54.     dbref player;
  55.     const char *msg;
  56.     int no_puppet;
  57. { }
  58.  
  59. void init_match(player, arg, type)
  60.     dbref player;
  61.     const char *arg;
  62.     int type;
  63. { }
  64.  
  65. void match_everything()
  66. { }
  67.  
  68. dbref match_thing(player, name)
  69.      dbref player;
  70.      const char *name;
  71. { return 1; }
  72.  
  73. dbref noisy_match_result()
  74. { return 1; }
  75.  
  76. char *tprintf(format, a, b, c, d, e, f)
  77.     char *format;
  78.     int a, b, c, d, e, f;
  79. { return (char *)""; }
  80.  
  81. void panic(message)
  82. const char *message;
  83. {
  84.   fprintf(stderr, "PANIC: %s\n", message);
  85.   exit(-1);
  86. }
  87.  
  88. /*****************************************************************************/
  89.  
  90. /* in a dump, you can see everything */
  91.  
  92. int controls(who, what)
  93.     dbref who;
  94.     dbref what;
  95. {
  96.   return 1;
  97. }
  98.  
  99. void main(argc, argv)
  100.     int argc;
  101.     char **argv;
  102. {
  103.   struct object *o;
  104.   dbref owner;
  105.   dbref thing;
  106.  
  107.   if (argc < 1) {
  108.     fprintf(stderr, "Usage: %s [owner]\n", *argv);
  109.     exit(1);
  110.   }
  111.  
  112.   if (argc >= 2) {
  113.     owner = atol(argv[1]);
  114.   } else {
  115.     owner = NOTHING;
  116.   }
  117.  
  118.   if (db_read(stdin) < 0) {
  119.     fprintf(stderr, "%s: bad input\n", argv[0]);
  120.     exit(5);
  121.   }
  122.  
  123.   for (o = db; o < db + db_top; o++) {
  124.     /* don't show it if it isn't owned by the right player */
  125.     if (owner != NOTHING && o->owner != owner)
  126.       continue;
  127.  
  128.     printf("OBJECT #%d: %s [OWNER: %s(#%d)]\nLOC: %s\nPENNIES: %d\nTYPE: ",
  129.        o - db, o->name, db[o->owner].name, o->owner,
  130.        unparse_object(owner, o->location), o->penn);
  131.     switch (o->flags & TYPE_MASK) {
  132.       case TYPE_ROOM:
  133.     printf("Room");
  134.     break;
  135.       case TYPE_EXIT:
  136.     printf("Exit");
  137.     break;
  138.       case TYPE_THING:
  139.     printf("Thing");
  140.     break;
  141.       case TYPE_PLAYER:
  142.     printf("Player");
  143.     break;
  144.       default:
  145.     printf("***UNKNOWN TYPE***");
  146.     break;
  147.     }
  148.  
  149.     /* handle flags */
  150.     putchar('\n');
  151.     if (o->flags & ~TYPE_MASK) {
  152.       printf("TYPE FLAGS: ");
  153.       switch(o->flags & TYPE_MASK) {
  154.     case TYPE_PLAYER:
  155.       if(o->flags & PLAYER_UNFIND) printf("Unfind ");
  156.       if(o->flags & PLAYER_NOSPOOF) printf("Nospoof ");
  157.       if(o->flags & PLAYER_TERSE) printf("Terse ");
  158.       if(o->flags & PLAYER_MYOPIC) printf("Myopic ");
  159.       if(o->flags & PLAYER_MONITOR) printf("Monitor ");
  160.       if(o->flags & PLAYER_GAGGED) printf("Gagged ");
  161.       if(o->flags & PLAYER_SUSPECT) printf("Suspect ");
  162.       break;
  163.         case TYPE_THING:
  164.       if(o->flags & THING_PUPPET) printf("Puppet ");
  165.       if(o->flags & THING_KEY) printf("Key ");
  166.       if(o->flags & THING_LISTEN) printf("Listener ");
  167.       if(o->flags & THING_SAFE) printf("Safe ");
  168.       if(o->flags & THING_STICKY) printf("Sticky ");
  169.       if(o->flags & THING_VERBOSE) printf("Verbose ");
  170. #ifdef DESTROY
  171.       if(o->flags & THING_DEST_OK) printf("Destroy_ok ");
  172. #endif /* DESTROY */
  173.       break;
  174.         case TYPE_ROOM:
  175.       if(o->flags & LINK_OK) printf("Link_Ok ");
  176.       if(o->flags & ROOM_TEMPLE) printf("Temple ");
  177.       if(o->flags & ROOM_UNFIND) printf("Unfindable ");
  178.       if(o->flags & ROOM_ABODE) printf("Abode ");
  179.       if(o->flags & ROOM_JUMP_OK) printf("Jump_Ok ");
  180.       if(o->flags & ROOM_FLOATING) printf("Floating ");
  181.       if(o->flags & ROOM_NO_TEL) printf("No_Tel ");
  182.       if(o->flags & ROOM_STICKY) printf("Sticky ");
  183.       if(o->flags & ROOM_TRANSPARENT) printf("Transparent ");
  184.       break;
  185.         case TYPE_EXIT:
  186.       if(o->flags & EXIT_TRANSPARENT) printf("Transparent ");
  187.       if(o->flags & EXIT_KEY) printf("Key ");
  188.       break;
  189.       }
  190.       printf("\nGENERAL FLAGS: ");
  191.       if(o->flags & WIZARD) printf("Wizard ");
  192.       if(o->flags & DARK) printf("Dark ");
  193.       if(o->flags & HAVEN) printf("Haven ");
  194.       if(o->flags & HALT) printf("Halt ");
  195.       if(o->flags & AUDIBLE) {
  196.     if ((o->flags & TYPE_MASK) != TYPE_PLAYER)
  197.       printf("Audible ");
  198.     else
  199.       printf("Ansi_Display ");
  200.       }
  201.       if(o->flags & QUIET) printf("Quiet ");
  202. #ifdef DESTROY
  203.       if(o->flags & GOING) printf("Destroyed ");
  204. #endif /* DESTROY */
  205.       if(o->flags & CHOWN_OK) printf("Chown_Ok ");
  206.       if(o->flags & ENTER_OK) printf("Enter_Ok ");
  207.       if(o->flags & VISUAL) printf("Visual ");
  208.       if(o->flags & OPAQUE) printf("Opaque ");
  209.       if(o->flags & STARTUP) printf("Startup ");
  210. #ifdef INHERIT_FLAG
  211.       if(o->flags & INHERIT) printf("Inherit ");
  212. #endif
  213. #ifdef ROYALTY_FLAG
  214.       if(o->flags & ROYALTY) printf ("Royalty ");
  215. #endif
  216.     }
  217.     putchar('\n');
  218.  
  219.     if (o->key != TRUE_BOOLEXP)
  220.       printf("KEY: %s\n", unparse_boolexp(owner, o->key, 0));
  221.     if (((o->flags & TYPE_MASK) == TYPE_PLAYER)
  222.     && (o->usekey != TRUE_BOOLEXP))
  223.       printf("USEKEY: %s\n", unparse_boolexp(owner, o->usekey, 0));
  224.     if (o->enterkey != TRUE_BOOLEXP)
  225.       printf("ENTERKEY: %s\n", unparse_boolexp(owner, o->enterkey, 0));
  226.     if(o->list) {
  227.       ALIST *list;
  228.       ATTR *my_attr;
  229.       printf("ATTRIBUTES:\n");
  230.       for(list = o->list; list; list = AL_NEXT(list)) {
  231.     if(!AL_BAD(list)) {
  232.       my_attr = AL_ATTR(list);
  233.       if(!strcasecmp("XYXXY", my_attr->name))
  234.         printf("\tPassword: %s\n", uncompress(AL_STR(list)));
  235.       else 
  236.         printf("\t%s: %s\n", my_attr->name, uncompress(AL_STR(list)));
  237.         }
  238.       }
  239.     }
  240.     if (o->contents != NOTHING) {
  241.       printf("CONTENTS:\n");
  242.       DOLIST(thing, o->contents) {
  243.     /* dump thing description */
  244.     printf("\t%s(%d) [OWNER: %s(%d)]\n",unparse_object(owner, thing),
  245.            thing, db[owner].name, owner);
  246.       }
  247.     }
  248.     if (o->exits != NOTHING) {
  249.       if ((o->flags & TYPE_MASK) == TYPE_ROOM) {
  250.     puts("EXITS:\n");
  251.     DOLIST(thing, o->exits) {
  252.       printf("\t%s ", unparse_object(owner, thing));
  253.           if (db[thing].location != NOTHING) {
  254.             printf(" => %s\n", unparse_object(owner, db[thing].location));
  255.           } else {
  256.             printf(" ***OPEN***\n");
  257.           }
  258.       if (db[thing].key != TRUE_BOOLEXP) {
  259.         printf("\tKEY: %s\n",
  260.            unparse_boolexp(owner, db[thing].key, 0));
  261.       }
  262.     }
  263.       } else {
  264.     printf("HOME: %s\n", unparse_object(owner, o->exits));
  265.       }
  266.     }
  267.     putchar('\n');
  268.   }
  269.   exit(0);
  270. }
  271.